package com.ace3l.legal.backend.dao;

import com.ace3l.legal.backend.domain.Student;

import javax.persistence.Query;

/**
 * Created by IntelliJ IDEA.
 * User: ageer
 * Date: Jul 22, 2008
 * Time: 10:08:16 AM
 * To change this template use File | Settings | File Templates.
 */
public class StudentDao extends ADao{
    public Student saveStudent(Student ms) {
        entityManager.persist(ms);
        return ms;
    }

    public Student getStudentAbridgedById(Integer id) {
        Query q = entityManager.createNamedQuery("student.byid.abridged");
        q.setParameter("id", id);
        Object[] result = (Object[])q.getSingleResult();
        Student ret = new Student();
        ret.setId(id);
        ret.setFirstName((String)result[1]);
        ret.setLastName((String)result[2]);
        return ret;
    }

    
}
